﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class FamilyRelationshipCategoryBL
	{

		#region ***** Init Methods ***** 
		FamilyRelationshipCategoryDA objFamilyRelationshipCategoryDA;
		public FamilyRelationshipCategoryBL()
		{
			objFamilyRelationshipCategoryDA = new FamilyRelationshipCategoryDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get FamilyRelationshipCategory by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>FamilyRelationshipCategory</returns>
		public FamilyRelationshipCategory GetByID(int id)
		{
			return objFamilyRelationshipCategoryDA.GetByID(id);
		}

		/// <summary>
		/// Get all of FamilyRelationshipCategory
		/// </summary>
		/// <returns>List<<FamilyRelationshipCategory>></returns>
		public List<FamilyRelationshipCategory> GetList()
		{
			string cacheName = "lstFamilyRelationshipCategory";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objFamilyRelationshipCategoryDA.GetList(), "FamilyRelationshipCategory");
			}
			return (List<FamilyRelationshipCategory>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of FamilyRelationshipCategory
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSet()
		{
			string cacheName = "dsFamilyRelationshipCategory";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objFamilyRelationshipCategoryDA.GetDataSet(), "FamilyRelationshipCategory");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of FamilyRelationshipCategory paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<FamilyRelationshipCategory>></returns>
		public List<FamilyRelationshipCategory> GetListPaged(int recperpage, int pageindex)
		{
			return objFamilyRelationshipCategoryDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of FamilyRelationshipCategory paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objFamilyRelationshipCategoryDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new FamilyRelationshipCategory within FamilyRelationshipCategory database table
		/// </summary>
		/// <param name="obj_familyrelationshipcategory">FamilyRelationshipCategory</param>
		/// <returns>key of table</returns>
		public int Add(FamilyRelationshipCategory obj_familyrelationshipcategory)
		{
			ServerCache.Remove("FamilyRelationshipCategory", true);
			return objFamilyRelationshipCategoryDA.Add(obj_familyrelationshipcategory);
		}

		/// <summary>
		/// updates the specified FamilyRelationshipCategory
		/// </summary>
		/// <param name="obj_familyrelationshipcategory">FamilyRelationshipCategory</param>
		/// <returns></returns>
		public void Update(FamilyRelationshipCategory obj_familyrelationshipcategory)
		{
			ServerCache.Remove("FamilyRelationshipCategory", true);
			objFamilyRelationshipCategoryDA.Update(obj_familyrelationshipcategory);
		}

		/// <summary>
		/// Delete the specified FamilyRelationshipCategory
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("FamilyRelationshipCategory", true);
			objFamilyRelationshipCategoryDA.Delete(id);
		}
		#endregion
	}
}
